/*
 * @Description: 
 * @Author: zoe
 * @Date: 2024-10-08 09:03:56
 * @LastEditors: rendc
 * @LastEditTime: 2024-10-08 09:05:30
 */
List<Integer> list = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
    list.add(i);
}
for (int i = 0; i < list.size(); i++) {
    System.out.println(list.get(i));
}


List<Integer> list = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
    list.add(i);
}
for (Integer number : list) {
    System.out.println(number);
}

List<Integer> list = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
    list.add(i);
}

Iterator<Integer> iterator = list.iterator();
while (iterator.hasNext()) {
    System.out.println(iterator.next());
}


List<Integer> list = new ArrayList<>();
for (int i = 1; i <= 5; i++) {
    list.add(i);
}

list.stream().forEach(System.out::println);